import {Component, createRef} from 'react'

export default class NameForm extends Component {

  inpEle = createRef()
  state = { 
    value: "" 
  }

  handleClick = () => {
    const value = this.inpEle.current.value;
    console.log(`提交的数据为${value}`);
  }

  render() {
    return (
      <>
        <input type="text" ref={this.inpEle}/>
        <button onClick={this.handleClick}>提交</button>
      </>
    );
  }
}
